<link rel="stylesheet" type="text/css" href="BuildAndControlStyling.css">

<script language="php">
session_start();

if (!isset($_SESSION['userlogin'])) 
{
	header("Location:index.php");
}

require("dbinfo.inc.php");
require("Formatting.php");
Heading();
</script>

<title>Database Query</title>
<html>
<body class=<?php teamScheme();?>>

<script language ='php'>
function tableHeaders()
{
	echo  "<table class=\'users\'>";	
	echo "<tr>";
	echo "<th>Username</th>";
	echo "<th>Team</th>";
	echo "<th>Mobile Number</th>";
	echo "</tr>";
	echo "<br/>";
}

function tableEntries($name,$teamcol,$phoneNum)
{
	echo "<tr>";
	echo "<td><b>$name</b></td>";
	echo "<td>$teamcol</td>";
	echo "<td>$phoneNum</td>";
	echo "</tr>";
}


mysql_connect($host,$dbusername,$dbpassword);//when on a server replace with "www.webaddress.com" note the quotes!!!
@mysql_select_db($database) or die("Unable to select database");//error control

$query="SELECT * FROM $userTable";
$result=mysql_query($query);
$num=mysql_numrows($result);

//loop and output database information
$i=0;

echo '<br><br>';

if ($num == 0)
{
	echo 'No Entries in database<br>';
}
else
{	
	/*tableHeaders();*/
	tableHeaders();

	while ($i < $num) 
	{
	$username=mysql_result($result,$i,"username");
	$team=mysql_result($result,$i,"team");
	$mobile=mysql_result($result,$i,"mobile");

	tableEntries($username,$team,$mobile);

	$i++;
	}
	
	echo "</table>";
}

mysql_close();
</script>

</body>
</html>

<script language="php">
//LinksTop();
LinksBot();
</script>